﻿using System.Windows;
using System.Windows.Data;
using ImageConverter.Converters;

namespace ImageConverter
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            DataContext = new ViewModel();

            Loaded += new RoutedEventHandler(MainWindow_Loaded);
        }

        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            SetBinding(WindowStateProperty, new Binding()
            {
                Source = DataContext,
                Path = new PropertyPath("IsMainWindowMinimized"),
                Converter = new BoolToWindowMinimizedConverter(),
                Mode = BindingMode.OneWay
            });
        }
    }
}
